<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript" src="edit.js"></script>
		
	</head>
	<body>
		<!--编辑器容器-->
		<div id="div3"></div>
		<div id="btn1">
			获取内容
		</div>
		
		<script type="text/javascript">
			var E = window.wangEditor;
			var editor2 = $("html").css("");
		    editor2 = new E('#div3');
			editor2.customConfig.uploadImgShowBase64 = true;   // 使用 base64 保存图片
			editor2.customConfig.pasteFilterStyle = true; //清除黏贴的样式
			editor2.create();
			document.getElementById('btn1').addEventListener('click', function () {
        // 读取 html
        	var memmoryHtml = editor2.txt.html().replace(/<\/p>/g, '/n '); //加入/n 换行符
            memmoryHtml = memmoryHtml.replace(/<((?!img).)*?>/g, ''); //过滤掉除了img所有标签
            memmoryHtml = memmoryHtml.replace( /alt=(".*?")/g,''); //替换img alt 属性
            memmoryHtml = memmoryHtml.replace( /&nbsp;/g,''); //替换 &nbsp;
           console.log(memmoryHtml)
    }, false)
//			.replace(/<((?!img).)*?>/g, '')
		</script>
	</body>
</html>
